﻿#include "engine.h"
#include "tick_signal.h"

using namespace lt ;

void tick_signal::on_init(lt::subscriber& suber)
{
	suber.regist_tick_receiver(_code,this);
};

void tick_signal::on_destory(lt::unsubscriber& unsuber)
{
	unsuber.unregist_tick_receiver(_code,this);
};

void tick_signal::on_tick(const tick_info& tick, const deal_info& deal)
{

	if(tick.price == tick.buy_price())
	{
		trigger(tick.id, signal_action_type::SACT_BULL, tick.price);
	}
	else if(tick.price == tick.sell_price())
	{
		trigger(tick.id, signal_action_type::SACT_BEAR, tick.price);
	}
}

